package com.hnhs.utils;

import lombok.Data;

@Data
public class ResultUtil {
    private int code;
    private Boolean status; //成功或失败的表示
    private String msg;
    private Object data;

    public ResultUtil() {
    }

    public ResultUtil(int code, Boolean status, String msg, Object data) {
        this.code = code;
        this.status = status;
        this.msg = msg;
        this.data = data;
    }
    //成功返回
    public static ResultUtil success(Object data){
        return new ResultUtil(200,true,"操作成功",data);
    }
    //成功返回并提醒msg的消息
    public static ResultUtil success(String msg,Object data){
        return new ResultUtil(200,true,msg,data);
    }
    //失败
    public static ResultUtil error(Integer code,String msg){
        return new ResultUtil(code,false,msg,null);
    }
}
